#ifndef SOCKS4A_H
#define SOCK4A_h
#include <unordered_map>
#include <mutex>
#include "muduo/net/EventLoop.h"
#include "tunnel.h"
typedef std::shared_ptr<Tunnel> TunnelPtr;
/**
 * @brief 这是socks4a server
 *
 */
class Socks4a : public TcpServer {
 public:
  Socks4a(EventLoop* loop, const InetAddress& listenAddr);
  void onServerConnection(const TcpConnectionPtr& conn);
  void onServerMessage(const TcpConnectionPtr& conn, Buffer* buf, muduo::Timestamp);

 private:
  std::unordered_map<std::string, TunnelPtr> tunnels_;  // 每一个conn->name 到Tunnel的映射
  std::mutex mutex_;
};
#endif